<body>
  <div>
    <div>
      <button id="start" class="sharebtn">点击分享</button>
      <button id="start" onclick="fullScreen()" class="btn">点击全屏</button>
      <button id="start" onclick="exitScreen()" class="btn">退出全屏</button>
    </div>
    <textarea id="" cols="30" rows="10"></textarea>
  </div>
</body>
<script>
  function handleCopy() {
    let text = "复制一个文本到输入框";
    navigator.clipboard.writeText(text);
  }

  function fullScreen() {
    document.documentElement.requestFullscreen();
  }

  function exitScreen() {
    document.exitFullscreen();
  }

    window.onbeforeunload = function (e) {
      console.log("页面将要关闭");
      return null;
    };

  let shareBtn = document.querySelector(".sharebtn");
  let share = async (data) => {
    try {
      await navigator.share(data);
    } catch (error) {
      console.error(error);
    }
  };

  shareBtn.addEventListener("click", () => {
    let shareData = {
      title: "分享的标题",
      url: "分享的链接",
      text: "分享的文本",
    };
    share(shareData);
  });

  let date = new Date(2023, 05, 15);
  console.log(new Intl.DateTimeFormat("zh-CN",{dateStyle:"full"}).format(date));
  console.log(new Intl.DateTimeFormat("it-IT").format(date));
  console.log(new Intl.DateTimeFormat("en-US").format(date));
  console.log(new Intl.DateTimeFormat("en-GB").format(date));
</script>

<style>
  body {
    display: flex;
    height: 90vh;
    align-items: center;
    justify-content: center;
  }
  #start {
    width: 100px;
    height: 40px;
    line-height: 35px;
    border-radius: 5px;
    border: none;
    color: #1e80ff;
    outline: none;
    font-size: 20px;
    margin-right: 100px;
    margin-bottom: 20px;
  }
  textarea {
    width: 500px;
  }
</style>
